import React from "react";

function ProfileHeader(props) {
    return (
        <div>
            <h2>姓名：{props.nickName}</h2>
            <h2>年龄：{props.age}</h2>
        </div>
    )
}

function Profile(props) {
    return (
        <div>
            {/* <ProfileHeader nickName={props.nickName} age={props.age}></ProfileHeader> */}
            <ProfileHeader {...props}></ProfileHeader>
            <ul>
                <li>设置1</li>
                <li>设置1</li>
                <li>设置1</li>
            </ul>
        </div>
    )
}

class App extends React.Component {
    constructor(props) {
        super(props);

        this.state = {
            nickName: "czw--",
            age: 23
        }
    }

    render() {
        // const {nickName, age} = this.state;
        return (
            <div>
                <Profile {...this.state}></Profile>
            </div>
        )
    }
}

export default App;